package top.lvkun.pet.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.lvkun.basic.utils.PageList;
import top.lvkun.pet.domain.Pet;
import top.lvkun.pet.query.PetQuery;
import top.lvkun.pet.service.IPetService;

@RestController
@RequestMapping("/front/pet")
public class FrontPetController {
    @Autowired
    private IPetService petService;

    /**
     * 前台展示已上架的宠物  分页查询+ 高级条件查询
     * @param petQuery
     * @return
     */
    @PostMapping
    public PageList<Pet> pageList(@RequestBody PetQuery petQuery){
         return petService.queryData(petQuery);
    }


    /**
     * 通过id查询宠物信息(包括产品宠物信息)
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Pet getById(@PathVariable("id") Long id){
        return petService.getById(id);
    }




}
